package com.cysd.ewmxns.ui.activity

import android.os.Bundle
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

import com.cszy.ewmxns.base.BaseVMActivity
import com.cysd.ewmxns.adapter.DetailsAdapter
import com.cysd.ewmxns.adapter.indexGridAdapter

import com.cysd.ewmxns.viewmodel.MainViewModel
import qrrspeeelild.rqrc0ode.andro0ild.R
import qrrspeeelild.rqrc0ode.andro0ild.databinding.ActivityDetail1Binding


class DetailActivity1 : BaseVMActivity<MainViewModel, ActivityDetail1Binding>() {
    //传一个type过来通过instance
    var type: String? = null
    //adapter
    private var adapter: DetailsAdapter? = null
    override fun initView(savedInstanceState: Bundle?) {

        mBinding.rvDetails.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this)
        adapter = DetailsAdapter()
        mBinding.rvDetails.adapter = adapter
        type = intent.getStringExtra("type")
        when (type) {
            "1" -> {
                mBinding.headTitle.headCenterTitle.text = "文字提取不精准怎么办"
                adapter?.submitList(mViewModel.getDetailsList1())
            }
            "0" -> {
                mBinding.headTitle.headCenterTitle.text = "扫码查价的信息准确吗"
                adapter?.submitList(mViewModel.getDetailsList())
            }
        }
    }



    override fun initListener() {
       mBinding.headTitle.headBack.setOnClickListener {
           finish()
       }
    }
}